package com.spa.infrastructure.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spa.application.dto.PageResult;
import com.spa.application.dto.admin.SysUserDto;
import com.spa.application.query.admin.AdminUserQuery;
import com.spa.domain.entity.SysUserEntity;
import com.spa.infrastructure.repository.condition.SysUserCondition;
import com.spa.infrastructure.repository.po.SysUserPO;
import org.mapstruct.Mapper;
import org.mapstruct.MapperConfig;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
@MapperConfig(unmappedTargetPolicy = ReportingPolicy.WARN)
public interface SysUserMapperStruct {

    SysUserMapperStruct INSTANCE = Mappers.getMapper(SysUserMapperStruct.class);

    Page<SysUserEntity> po2Entity4Page(Page<SysUserPO> po);

    PageResult<SysUserDto> entity2Dto4Page(Page<SysUserEntity> entity);


    SysUserCondition query2Command(AdminUserQuery query);

    SysUserEntity po2Entity(SysUserPO po);

    @Mapping(source = "nickName",target = "name")
    SysUserDto entity2Dto(SysUserEntity entity);

    List<SysUserEntity> po2Entity4List(List<SysUserPO> po);





}
